﻿<UserControl x:Class="DeltaGroup.WheelOfJeopardy.UI.Controls.WheelSector"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
	mc:Ignorable="d"  
	x:Name="ucWheelSector"
	d:DesignWidth="400" d:DesignHeight="400"
    Width="400" Height="400">
    <UserControl.Resources>
        <Style TargetType="{x:Type ed:Arc}" x:Key="StaticSectorArcStyle">
            <Setter Property="Stroke" Value="Black"/>
            <Setter Property="ArcThicknessUnit" Value="Percent"/>
            <Setter Property="ArcThickness" Value="0.85"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Stretch" Value="None"/>
            <Setter Property="ClipToBounds" Value="True"/>
        </Style>
        <SolidColorBrush x:Key="ArcFill">White</SolidColorBrush>

    </UserControl.Resources>
    <Canvas x:Name="canvas" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="True">
        <Canvas.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform Angle="{Binding ElementName=ucWheelSector, Path=SectorInfo.StartAngle}"/>
                <TranslateTransform/>
            </TransformGroup>
        </Canvas.RenderTransform>

        <ed:Arc x:Name="arc0"
				StartAngle="0" EndAngle="{Binding ElementName=ucWheelSector, Path=SectorInfo.ArcAngle}" 
                Style="{StaticResource ResourceKey=StaticSectorArcStyle}"
                Fill="{DynamicResource ArcFill}"
                Height="400" Width="400" 
                IsHitTestVisible="True" >
            <ed:Arc.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </ed:Arc.RenderTransform>
        </ed:Arc>
        <TextBlock Name="captionLabel"
                   Text="{Binding ElementName=ucWheelSector, Path=SectorInfo.Title}"
                   MouseDown="captionLabel_MouseDown"
                   Canvas.Left="{DynamicResource Caption.Canvas.Left}"  
                   Canvas.Top="{DynamicResource  Caption.Canvas.Top}"
                   RenderTransformOrigin="0.5,0.5" 
                   TextWrapping="{DynamicResource  Caption.TextWrapping}" 
                   HorizontalAlignment="{DynamicResource  Caption.HorizontalAlignment}" 
                   TextAlignment="{DynamicResource  Caption.TextAlignment}"  
                   Width="{DynamicResource  Caption.Width}" Height="{DynamicResource  Caption.Height}"  
                   Visibility="Visible" 
                   Focusable="True" IsHyphenationEnabled="True" 
                   FontWeight="Bold" FontSize="{DynamicResource  Caption.FontSize}" Foreground="{DynamicResource  Caption.BrushKey}" 
                   ScrollViewer.VerticalScrollBarVisibility="Disabled" FontStretch="Normal" d:IsLocked="True" 
                   VerticalAlignment="{DynamicResource  Caption.VerticalAlignment}" 
                   RenderTransform="{DynamicResource Caption.RenderTransform}" TextTrimming="{DynamicResource Caption.TextTrimming}" IsHitTestVisible="True" IsManipulationEnabled="True">
        </TextBlock>
    </Canvas>
</UserControl>
